package xmist.edu.pojo;

public class Student {

    /**
     * 学号
     */
    private int stuNo;
    /**
     * 年龄
     */
    private int age;
    /**
     * 名字
     */
    private String name;
    /**
     * 身份证
     */
    private String idNumber;

    public Student(int stuNo, int age, String name, String idNumber) {
        this.stuNo = stuNo;
        this.age = age;
        this.name = name;
        this.idNumber = idNumber;
    }

    public int getStuNo() {
        return stuNo;
    }

    public void setStuNo(int stuNo) {
        this.stuNo = stuNo;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }
    /**
     * 判定同样的学生是否重复出现
     * @param anObj
     * @return
    */
    @Override
    public boolean equals(Object anObj){
        System.out.println("equals(Object anotherObj)方法重写");
        if (this == anObj) {
            return true;
        }
        if (!(anObj instanceof Student)) {
            return false;
        }
        Student other = (Student) anObj;
        if (this.stuNo == other.stuNo && this.name.equals(other.name)) {
            return true;
        }
        return false;
    }
    }




